import { createStore, createLogger } from 'vuex'
import user from './modules/user.js'
import category from './modules/category'
import cart from './modules/cart'
import createPersistedState from 'vuex-persistedstate' // 本地持久化插件
export default createStore({
  state: {},
  getters: {},
  mutations: {},
  actions: {},
  modules: {
    user,
    category,
    cart
  },
  plugins: [
    createPersistedState({
      key: 'rabbit', // 本地持久化key
      paths: ['user', 'category', 'cart'] // 持久化模块名
      // paths: ['user.profile.nickname'] // 持久化具体数据
    }),
    createLogger()
  ]
})
